<script>
function checkform(){
	if ($('input[name="name"]').val() == '') {
		alert('请填写臂章名称');
		return false;
	}
	if ($('input[name="price"]').val() == '') {
		alert('请填写臂章价格');
		return false;
	}
	test = /^(\d+)$/;
	if (!test.test($('input[name="price"]').val())) {
		alert('请填写臂章价格');
		return false;
	}
	commonEffection.setLoading();
	$('#addBulletinForm').submit();
}
</script>
<div class="frame_pmtips" style="margin-bottom: 4px;">
	<div class="tips_body">
	在发布产品的时候指定特定臂章 <br />
	</div>
</div>
<div class="frame_addfactoryDiv">
  <form name="addBulletinForm" id="addBulletinForm" enctype="multipart/form-data" action="administrator<?=CHOSING_DE?>badge<?=CHOSING_DE?>edit" method="post">
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
    <tr>
      <td class="ri-bbgg">臂章信息：</td>
      <td class="le">
        <div>
        	 <div>
        	 	<input type="text" name="name" value="<?php echo $this->badge->badge_name;?>" />				
			 </div>
        </div>
        <iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
    </tr>
    <tr>
      <td class="ri-bbgg">价格：</td>
      <td class="le">
        <div>
        	 <div>        	 	
				<input type="text" name="price" value="<?php echo $this->badge->badge_price?>" />				
			 </div>
        </div>
        <iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
    </tr>
    <tr>
      <td class="ri-bbgg">上传图片：</td>
      <td class="le">
        <div>
        	 <div>        	 	
				<input type="file" name="badgepatch_img" />
				<input type="button" onclick="uploadimg(this);" value="上传" />（可连续上传）
			 </div>
        </div>
        <iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
    </tr>    
    <tr>
      <td class="ri-bbgg">图片信息：</td>
      <td class="le">
        <div id="img_content">
        	<?php if ($this->imgArr):?>
         	<?php foreach ($this->imgArr as $v):?>
        	 	<div>
	        	 	<input type="hidden" name="badge_img[]" value="<?php echo $v;?>" />
	        	 	<img src="<?php echo $v;?>" width="50" height="50" />
	        	 	<input type="button" value="删除" onclick="$(this).parent().remove();" />
        	 	</div>
         	<?php endforeach;?>
         	<?php endif;?>
         	<input type="hidden" name="id" value="<?php echo $this->id;?>" />
        </div>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="se" align="center">
        <input name="button2" type="button" class="iput" value="保 存" onclick="checkform()" />　　
        <input name="button" type="button" class="iput" value="返 回" onclick="commonEffection.confirmBack();" />
      </td>
    </tr>
  </table>
  </form>
</div>
<script>
	
	function uploadimg(obj)
	{
		var oldAction=$('#addBulletinForm').attr('action');
		var oldTarget=$('#addBulletinForm').attr('target');
		$('#addBulletinForm').attr('action','administrator-badge-uploadimg1');
		$('#addBulletinForm').attr('target','productIframe');
		$('#addBulletinForm').submit();
		$('#addBulletinForm').attr('action',oldAction);
		$('#addBulletinForm').attr('target',oldTarget);
	}
	function setImg(url)
	{
		$('#img_content').append('<div><input name="badge_img[]" value="'+url+'" type="hidden"\/><img src="'+url+'" width="50" height="50" \/><input type="button" value="删除" onclick="$(this).parent().remove();" \/></div>');
		commonEffection.resetFrame('admins_frame',true);
	}
</script>